Skip to content

feat: extra registration fields improvements#1669

Open
BryanttV wants to merge 14 commits into
openedx:masterfrom
eduNEXT:bav/extra-registration-fields-improvements
Open

feat: extra registration fields improvements#1669
BryanttV wants to merge 14 commits into
openedx:masterfrom
eduNEXT:bav/extra-registration-fields-improvements

Conversation

@BryanttV
Copy link
Copy Markdown

@BryanttV BryanttV commented Apr 28, 2026

Description

This PR improves the FormFieldRenderer component and the configurable registration form with better UX feedback, input validation, and more robust error message handling.

  1. Placeholder support for text and textarea fields in FormFieldRenderer.
  2. minLength and maxLength restriction applied natively on text inputs using fieldData.restrictions.max_length and fieldData.restrictions.min_length.
  3. Animated help text on focus, displays fieldData.instructions while the field is focused, using TransitionReplace.
  4. Error message normalization, new normalizeErrorMessage utility that converts backend error messages arriving as objects (e.g., { required: "..." }) to strings, preventing [object Object] from being displayed.
  5. Flexible options format for select fields, automatically handling both array ([['key', 'value']]) and object ({ key: 'value' }) formats via Object.entries() conversion.

Testing Instructions

Using Tutor:

  1. Create a mount of the MFE, cloning this repository in your tutor root environment, and run tutor mounts add frontend-app-authn.

  2. In the MFE folder, run nvm use && npm install

  3. In your tutor root environment, run tutor dev start -d

  4. Install this Django app to use user extra fields: https://github.com/BryanttV/custom-extra-fields

  5. Add the following setting to your platform:

    REGISTRATION_EXTENSION_FORM = "custom_extra_fields.forms.CustomExtraFieldsForm"
  6. Create a new site configuration in http://local.openedx.io:8000/admin/site_configuration/siteconfiguration/add/ and add the following json:

    {
      "ENABLE_DYNAMIC_REGISTRATION_FIELDS": "true",
      "MFE_CONFIG": {
        "ENABLE_DYNAMIC_REGISTRATION_FIELDS": "true"
      },
      "REGISTRATION_EXTRA_FIELDS": {
        "nickname": "required",
        "birthdate": "required",
        "interests": "required",
        "wants_newsletter": "required",
        "favorite_language": "required"
      },
      "extended_profile_fields": [
        "nickname",
        "birthdate",
        "interests",
        "wants_newsletter",
        "favorite_language"
      ]
    }
  7. Go to the registration page

  8. You can test the new validations, user feedback, and error messages.

Screenshots/sandbox (optional):

Before After
Required field message ERROR 💥 image
Dropdown Field ERROR! 💥 image
Without placeholder and help text image With placeholder and help text image
Without max length restriction image With max length restriction image

Merge Checklist

  • If your update includes visual changes, have they been reviewed by a designer? Send them a link to the Sandbox, if applicable.
  • Is there adequate test coverage for your changes?

Post-merge Checklist

  • Deploy the changes to prod after verifying on stage or ask @openedx/2u-infinity to do it.
  • 🎉 🙌 Celebrate! Thanks for your contribution.

@openedx-webhooks
Copy link
Copy Markdown

openedx-webhooks commented Apr 28, 2026

Thanks for the pull request, @BryanttV!

This repository is currently maintained by @openedx/2u-infinity.

Once you've gone through the following steps feel free to tag them in a comment and let them know that your changes are ready for engineering review.

🔘 Get product approval

If you haven't already, check this list to see if your contribution needs to go through the product review process.

  • If it does, you'll need to submit a product proposal for your contribution, and have it reviewed by the Product Working Group.
    • This process (including the steps you'll need to take) is documented here.
  • If it doesn't, simply proceed with the next step.
🔘 Provide context

To help your reviewers and other members of the community understand the purpose and larger context of your changes, feel free to add as much of the following information to the PR description as you can:

  • Dependencies

    This PR must be merged before / after / at the same time as ...

  • Blockers

    This PR is waiting for OEP-1234 to be accepted.

  • Timeline information

    This PR must be merged by XX date because ...

  • Partner information

    This is for a course on edx.org.

  • Supporting documentation
  • Relevant Open edX discussion forum threads
🔘 Get a green build

If one or more checks are failing, continue working on your changes until this is no longer the case and your build turns green.

Details
Where can I find more information?

If you'd like to get more details on all aspects of the review process for open source pull requests (OSPRs), check out the following resources:

When can I expect my changes to be merged?

Our goal is to get community contributions seen and reviewed as efficiently as possible.

However, the amount of time that it takes to review and merge a PR can vary significantly based on factors such as:

  • The size and impact of the changes that it introduces
  • The need for product review
  • Maintenance status of the parent repository

💡 As a result it may take up to several weeks or months to complete a review and merge your PR.

@openedx-webhooks openedx-webhooks added open-source-contribution PR author is not from Axim or 2U core contributor PR author is a Core Contributor (who may or may not have write access to this repo). labels Apr 28, 2026
@github-project-automation github-project-automation Bot moved this to Needs Triage in Contributions Apr 28, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 28, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.09%. Comparing base (211cfcb) to head (74a266d).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1669      +/-   ##
==========================================
+ Coverage   91.02%   91.09%   +0.07%     
==========================================
  Files         110      110              
  Lines        2350     2359       +9     
  Branches      667      671       +4     
==========================================
+ Hits         2139     2149      +10     
- Misses        204      205       +1     
+ Partials        7        5       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mphilbrick211 mphilbrick211 moved this from Needs Triage to Waiting on Author in Contributions Apr 29, 2026
@BryanttV BryanttV force-pushed the bav/extra-registration-fields-improvements branch from ce8bdba to e545490 Compare April 29, 2026 19:36
@BryanttV BryanttV requested a review from bra-i-am April 30, 2026 19:01
Copy link
Copy Markdown

@bra-i-am bra-i-am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BryanttV, thanks for this PR. The changes are working as expected:

Image

I just left some minor comments, I'll give my approval once changes are addressed :D

Comment thread src/field-renderer/FieldRenderer.jsx
Comment thread src/field-renderer/tests/FieldRenderer.test.jsx Outdated
Comment thread src/field-renderer/tests/FieldRenderer.test.jsx Outdated
Comment thread src/field-renderer/tests/FieldRenderer.test.jsx Outdated
Comment thread src/field-renderer/FieldRenderer.jsx Outdated
@BryanttV BryanttV force-pushed the bav/extra-registration-fields-improvements branch from 15d4c5f to f93abb0 Compare May 11, 2026 14:41
@BryanttV BryanttV force-pushed the bav/extra-registration-fields-improvements branch from f93abb0 to c6afbf4 Compare May 11, 2026 18:32
@BryanttV
Copy link
Copy Markdown
Author

Hi @bra-i-am, thanks for the review! I’ve addressed your comments here: c6afbf4

@BryanttV BryanttV requested a review from bra-i-am May 11, 2026 18:51
Copy link
Copy Markdown

@bra-i-am bra-i-am left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks @BryanttV

@BryanttV BryanttV marked this pull request as ready for review May 13, 2026 21:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core contributor PR author is a Core Contributor (who may or may not have write access to this repo). open-source-contribution PR author is not from Axim or 2U

Projects

Status: Waiting on Author

Development

Successfully merging this pull request may close these issues.

4 participants